package com.lsa.letcode.the50.pow;


import org.junit.Assert;
import org.junit.Test;

public class PowTest {
	private static final double DELTA = 0.001;

	@Test
	public void test(){
		Solution s = new Solution();
		test(s, 1.00000, -2147483648);
		test(s, 20.0, 4);
		test(s, -20.0, 4);
		test(s, 0, 4);
		test(s, 0, 0);
		test(s, 2, 12);
		test(s, -2, 12);
		test(s, 0, -1);
		test(s, 2, -1);
		test(s, 0.00001, 2147483647);
	}

	private void test(Solution s, double a, int n) {
		Assert.assertEquals(Math.pow(a, n), s.myPow(a, n), DELTA);
	}
}
